from ast import arg
import os
import sys


path =sys.argv[1]


def dos2unix(file_path):
    with open(file_path, 'r', newline='') as file:
        content = file.read()
    with open(file_path, 'w', newline='') as file:
        file.write(content)

directory = path  # 请替换为实际文件夹路径
for root, dirs, files in os.walk(directory):
    for file in files:
        if file.endswith('.sh') or file.endswith('.txt'):  # 根据需要添加其他文件扩展名
            file_path = os.path.join(root, file)
            dos2unix(file_path)
            print(f'已转换：{file_path}')